﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.MediaCenter.UI;
using Microsoft.MediaCenter.Hosting;
using Level65.WMVHelper;
using Level65.ClipShow;


namespace ClipShow
{
    public class GraphicExplore : CoreUICodeBehind 
    {
        public GraphicExplore()
        {
            base.BuildLibraryOptions(true);
            base.BuildMediaTopics(0);

            PreviewChannelItem pci = (PreviewChannelItem)base.MediaLibraryItems.Options[10];
            this.CurrentHomeThumb = pci.Thumbnail;

            //ClipShowContent csc = (ClipShowContent)base.MediaLibraries.Options[0];
            //ClipItem ci = (ClipItem)csc.KeywordItems[1];
            //MediaMetaData pci = (MediaMetaData)csc.MediaItems[5];


            //this.CurrentHomeThumb = new Image(BuildImagePath(pci.ThumbnailUrl));

            _childThumbs = new Choice();
            ArrayListDataSet temp = new ArrayListDataSet();
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[6]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[7]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[8]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[9]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[10]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[11]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[12]);
            temp.Add((PreviewChannelItem)base.MediaLibraryItems.Options[13]);
            _childThumbs.Options = temp;

        }

        private Image _currentHomeThumb;
        private Choice _childThumbs;
        private Int32 _viewedRows = 6;
        private Int32 _viewedCols = 1;

        public Int32 ViewRows
        {
            get
            {
                if (_childThumbs.Options.Count > 6)
                {
                    return (_viewedRows);
                }
                else
                {
                    return (_childThumbs.Options.Count);
                }
                
            }
        }
        public Int32 ViewColumns
        {
            get
            {
                int modulus = _childThumbs.Options.Count % 6;
                return (modulus);
            }
        }

        public Image CurrentHomeThumb
        {
            get
            {
                return (_currentHomeThumb);
            }
            set
            {
                _currentHomeThumb = value;
            }
        }

        public Choice ChildThumbs
        {
            get
            {
                return (_childThumbs);
            }
        }


    }
}
